<template>
    <div class="step-wrap">
        <div class="step-item" :class="{'active': index == active, 'passed': index < active}" v-for="(item, index) in data" :key="index">
            <div class="step-title">
                <span class="num">{{ index + 1 }}</span>
                <span class="done el-icon-circle-check"></span>
                <span class="text">{{ item.title }}</span>
            </div>
            <div class="step-descr">{{ item.descr }}</div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'stepComp', // 步骤条组件
    props: {
        data: {
            type: Array,
            default() {
                return []
            }
        },
        active: {
            type: Number,
            default: 0
        }
    },
    components: {},
    data() {
        return {

        }
    },
    methods: {

    }
}
</script>

<style lang="scss" scoped>
.step-wrap {
    padding: 10px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #c0c4cc;
    .step-item {
        width: 220px;
        text-align: center;
        &.active {
            .step-title {
                .num {
                    background: #f8ac59;
                }
                
                .text {
                    color: #f8ac59;
                    font-weight: 600;
                }
            }
        }
        &.passed {
            .step-title {
                .num {
                    display: none;
                }
                .done {
                    display: inline-block;
                }
            }
        }
        .step-title {
            font-size: 0;
            margin-bottom: 10px;
            .num {
                font-size: 14px;
                display: inline-block;
                vertical-align: middle;
                width: 24px;
                height: 24px;
                text-align: center;
                line-height: 24px;
                border-radius: 50%;
                color: #fff;
                background: #eee;
            }
            .done {
                display: none;
                vertical-align: middle;
                color: #4CAF50;
                font-size: 24px;
            }
            .text {
                font-size: 20px;
                color: #c0c4cc;
                margin-left: 10px;
                vertical-align: middle;
            }
        }
        .step-descr {
            padding-left: 30px;
            font-size: 14px;
            color: #c0c4cc;
        }
    }
}
</style>